/*************************************************************************
 * File Name:    B.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Tue 08 Oct 2013 10:17:31 PM CST
 * 
 * Description:  http://codeforces.com/contest/280/problem/B
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>

using namespace std;

int
main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    int n, ans, t;
    stack<int> s;

    cin >> n;
    ans = 0;
    while (n--) {
        cin >> t;

        while (!s.empty()) {
            ans = max(ans, s.top() ^ t);
            if (s.top() > t) break;

            s.pop();
        }
        s.push(t);
    }
    cout << ans << endl;

    return 0;
}
